// 基于准备好的dom，初始化echarts图表
var myChart1 = echarts.init(document.getElementById('myorder1'),'macarons'); 
var myChart3 = echarts.init(document.getElementById('myorder3'),'macarons');
var myChart4 = echarts.init(document.getElementById('myorder4'),'macarons');
var myChart5 = echarts.init(document.getElementById('myorder5'),'macarons');
var myChart6 = echarts.init(document.getElementById('myorder6'),'macarons');
var myChart7 = echarts.init(document.getElementById('myorder7'),'macarons');
var option1 = {
    tooltip : {
        trigger: 'axis',
		textStyle : {
			align:'left'
		},
    },
	title : {
        text: '4_1:TOP10商品每天收入情况',
        x:'center'
    },
    legend: {
		y:'30px',
        data:['PRB','MMB','MMA','BSY','PWM','SFL','MMD']
    },
    calculable : true,
	grid : {y:80,y2:40,x:60,x2:20},
    xAxis : [
        {
            type : 'category',
            boundaryGap : false,
            data : ['20','30','40','50','60','70','80']
        }
    ],
    yAxis : [
        {
            type : 'value',
			axisLabel : {
			},
        }
    ],
    series : [
        {
            name:'PRB',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[0, 5, 15, 63, 90, 43, 22]
        },
        {
            name:'MMB',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[0, 1, 25, 83, 120, 101, 44]
        },
        {
            name:'MMA',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[64, 1316, 1249, 872, 780, 444, 174]
        },
        {
            name:'BSY',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[1, 121, 1145, 1827, 2157, 1840, 747]
        },
        {
            name:'PWM',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[2, 254, 1714, 4059, 2569, 968, 346]
        },
        {
            name:'SFL',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[23, 5945, 16486, 16981, 12214, 7397, 2745]
        },
        {
            name:'MMD',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[453, 14716, 55525, 77644, 88252, 59886, 22944]
        }
		
    ]
};
                   
var  option3 = {
	title : {
        text: '不同年龄段客户AUM、存款、贷款情况',
		x:'center'
    },
    tooltip : {
        trigger: 'axis',
		textStyle : {
			align:'left'
		},
		position : function(point,params,dom,rect,size){
			//其中params为当前鼠标的位置
			return [params[0],'30%'];
		}
    },
	
	calculable : true,
	grid : {y:110,y2:40,x:10,x2:100},
    legend: {
        data:['AUM','存款','贷款','往來存款','儲蓄存款','定期存款','銀團貸款','定期貸款','分期貸款'],
		y:'30px',
    },
    xAxis : [
        {
            type : 'category',
            splitLine : {show : false},
            data : ['20','30','40','50','60','70','80','>80']
        }
    ],
    yAxis : [
        {
            type : 'value',
			position : 'right',
			name: "值(万元)",
        }
    ],
    series : [
        {
            name:'AUM',
            type:'bar',
            data:[3471.491512, 370985.353716, 1862342.205796, 4449784.141850, 4664069.856032, 3896864.780985, 2448142.000898, 1745377.265409]
        },
		{
            name:'存款',
            type:'bar',
            data:[2718.366405, 249314.457446, 1127512.582005, 2573534.878534, 3125413.875577, 2675692.386045, 1513868.687398, 1054003.021779]
        },
        {
            name:'往來存款',
            type:'bar',
            stack: '存款',
            data:[1915.015525, 161701.108596, 643764.710512, 1442401.003800, 1996396.680658, 1829970.947610, 928715.585253, 618900.548094]
        },
        {
            name:'儲蓄存款',
            type:'bar',
            stack: '存款',
            data:[2715.830024, 248632.363086, 1124300.379144, 2555889.899005, 3104688.865741, 2653540.726614, 1486352.321703, 1023415.058586]
        },
        {
            name:'定期存款',
            type:'bar',
            stack: '存款',
            data:[605.762868, 123823.084791, 627588.176935, 1541800.531108, 2267788.602671, 2118297.918818, 1245699.700043, 866140.213122]
        },
		
		{
            name:'贷款',
            type:'bar',
            data:[419.143215, 79541.417968, 406819.574021, 820605.743755, 670158.452528, 257917.703969, 77793.857501, 45109.190301]
        },
        {
            name:'銀團貸款',
            type:'bar',
            stack: '贷款',
            data:[0, 0, 0, 0, 0, 0, 0, 0]
        },
        {
            name:'定期貸款',
            type:'bar',
            stack: '贷款',
            data:[0, 9234.680055, 127032.203877, 348208.253798, 232262.171823, 46529.416721, 18901.946904, 3526.413630]
        },
        {
            name:'分期貸款',
            type:'bar',
            stack: '贷款',
            data:[419.143215, 66509.826843, 231260.656419, 389129.142904, 402728.651585, 187678.123706, 43902.967336, 16749.859204]
        },
		
		

        {
            name:'总额',
            type:'pie',
            tooltip : {
                trigger: 'item',
                formatter: '{a} <br/>{b} : {c} ({d}%)',
				position : function(point,params,dom,rect,size){
					//其中params为当前鼠标的位置
					return [params[0],'30%'];
				}
            },
            center: ['15%','40%'],
            radius : [0, '25%'],
            itemStyle : {
                normal : {
                    labelLine : {
                        length : 100
                    },
					label : {
						show: true,
						position:'inner',
					} 
                }
            },
			color : [
				'rgb(46,199,201)','rgb(182,162,222)','rgb(141,152,179)'
			],
            data:[
                {value:218488664544.28, name:'AUM'},
                {value:140970061298.50, name:'存款'},
                {value:24190547191.95, name:'贷款'}
            ]
        }
    ]
};
                    
var option4 = {
    title : {
        text: '零售个人客户数',
		x:'center'
    },
    tooltip : {
		axisPointer : {
			type: 'none',
		},
        trigger: 'axis',
		
    },
    legend: {
		y:'30px',
        data:['招商银行', '永隆银行']
    },
    calculable : true,
    xAxis : [
        {
			show : false,
            type : 'value',
        }
    ],
    yAxis : [
        {
			show : false,
            type : 'category',
            data : ['总数']
        }
    ],
    series : [
	
        {
            name:'招商银行',
            type:'bar',
			data : [
				{name: '招商银行', value: 3861}
			],
			itemStyle: {
				normal : {
					label : {
						show : true,
						position : 'insideTop',
						textStyle : {
							color : 'white',
							fontsize : 18
						}
					}
					
				}
			}
			
        },
        {
            name:'永隆银行',
            type:'bar',
			data : [
				{name: '招商银行', value: 48899}
			],
			itemStyle: {
				normal : {
					label : {
						show : true,
						position : 'insideTop',
						textStyle : {
							color : 'white',
							fontsize : 18
						}
					}
					
				}
			}
        }
    ]
};
var option5 = {
    title : {
        text: '客户等级占比情况',
        x:'center'
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient : 'vertical',
        x : 'left',
        data:['PRB','MMB','MMA','BSY','PWM','SFL','MMD']
    },
    calculable : true,
    series : [
        {
            name:'访问来源',
            type:'pie',
            radius : '55%',
            center: ['50%', '60%'],
			minAngle: '15',
			itemStyle : {
                normal : {
                    label : {
                        position : 'outer',
                        formatter : function (params) {                         
                          return params.name + ': ' + (params.percent - 0).toFixed(0) + '%'
                        }
                    },
                    labelLine : {
                        show : true
                    }
                }
			},
            data:[
                {value:172, name:'PRB'},
                {value:418, name:'MMB'},
                {value:5097, name:'MMA'},
                {value:8265, name:'BSY'},
                {value:10267, name:'PWM'},
                {value:65065, name:'SFL'},
                {value:357831, name:'MMD'}
            ]
        }
    ]
};
var option6 = {
    title : {
        text: '不同年龄段占比情况',
        x:'center'
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient : 'vertical',
        x : 'left',
        data:['20','30','40','50','60','70','80']
    },
    calculable : true,
    series : [
        {
            name:'年龄占比',
            type:'pie',
            radius : '55%',
            center: ['50%', '60%'],
			minAngle: '15',
			itemStyle : {
                normal : {
                    label : {
                        position : 'outer',
                        formatter : function (params) {                         
                          return params.name + ':  ' + (params.percent - 0).toFixed(0) + '%'
                        }
                    },
                    labelLine : {
                        show : true
                    }
                }
			},
            data:[
                {value:543, name:'20'},
                {value:22358, name:'30'},
                {value:76159, name:'40'},
                {value:101529, name:'50'},
                {value:106135, name:'60'},
                {value:70658, name:'70'},
                {value:27012, name:'80'}
            ]
        }
    ]
};
// 为echarts对象加载数据 
myChart1.setOption(option1); 
myChart3.setOption(option3); 
myChart4.setOption(option4); 
myChart5.setOption(option5); 
myChart6.setOption(option6); 
myChart7.setOption(option7); 

/*窗口自适应*/
setTimeout(function(){
	window.onresize = function () {
		myChart1.resize();
		myChart3.resize();
		myChart4.resize();
		myChart5.resize();
		myChart6.resize();
		myChart7.resize();
	}
},200);



